package com.zeus.core.rule;

import com.zeus.common.enums.ZeusAlarmModelEnum;

/**
 * 聚合规则工厂
 *
 * @author f1ybear_wang  2022/3/3 3:23 下午
 */
public class GatherRuleFactory {
    /**
     * 构造私有化
     *
     * @author f1ybear_wang  2022/3/3 4:52 下午
     */
    private GatherRuleFactory() {
        // default
    }

    /**
     * 获取规则
     * 
     * @param   modelEnum 模式
     * @return 规则
     * @author f1ybear_wang  2022/3/3 4:53 下午
     */
    public static GatherRule getRule(ZeusAlarmModelEnum modelEnum) {
        if (ZeusAlarmModelEnum.NORMAL.equals(modelEnum)) {
            return new GatherRuleNormal();
        } else if (ZeusAlarmModelEnum.THRESHOLD_COUNT.equals(modelEnum)) {
            return new GatherRuleThresholdCount();
        } else if (ZeusAlarmModelEnum.THRESHOLD_TIME.equals(modelEnum)) {
            return new GatherRuleThresholdTime();
        } else {
            // 默认
            return new GatherRuleNormal();
        }
    }

}
